<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    html,
    body {
      height: 100%;
      height: 100vh;
    }

    .iframe-wrapper {
      /* width: 100vmin; */
      /* width: 100vw; */
      /* width: 100vh; */
      background-color: rgb(90, 91, 113);
      height: 100vh;
    }
  </style>
  <div class="iframe-wrapper">iframe-wrapper内容</div>




  <script>
    // 在iframe内部发送消息
    window.parent.postMessage('你好-父页面', '*');
    // iframe 页面接收消息  在iframe内部
    window.addEventListener('message', (event) => {
      if (event.source !== window) {
        console.log('来自主页面的消息====>', event.data);
      }
      // 检查源，确保消息来自可信来源
    });
  </script>;
</body>

</html>